public void scriptFunction(arg) {
    println("groovy script invoke test : " + arg);
}

public int calculatorTest(param1, param2) {
    return (param1 + param2) * 2;
}

public int invokeCalculator(sum) {
    return sum / 5;
}

public Object returnMap(inputMap) {
    def outputData = [:];
    outputData.putAll(inputMap);
    return outputData;
}

public Object toUpperTestForArrayList(oDatas1) {
//    def inputData = [];
//    def outputData = [];
//
//    inputData.addAll(oDatas1);
//    for ( i in inputData) {
//        outputData[i] = oDatas1[i].toUpperCase();
//    }
//    return outputData;
    return oDatas1;
}

public Object uioControllerForMap(arguments) {

    def inputData = [:];

    inputData.putAll(arguments);

    Set keys = inputData.keySet();
    Iterator iter = keys.iterator();
    StringBuffer returnText = new StringBuffer();
    while (iter.hasNext()) {
        String key = iter.next();
        String value = inputData.get(key);
        returnText.append("++" + value + "++\n");
    }

    if (returnText == null)
        return 'Data Model 의 데이터';
    else
        return returnText.toString();
}

public Object replaceParams(param) {
    def outputData = [:];

    outputData.putAll(param);

    Set keys = outputData.keySet();
    Iterator iter = keys.iterator();
    while (iter.hasNext()) {
        String key = (String) iter.next();
        Object value = outputData.get(key);
        if (key == "name")
            value = "choco";
        else {
            output = Integer.parseInt(value);
            value = output * 3;
        }
        outputData.put(key, value);
    }

    return outputData;
}

public Object testMethod_2(input) {
    def outputData = [:];

    outputData.putAll(input);

    Set keys = outputData.keySet();
    Iterator iter = keys.iterator();
    StringBuffer returnValue = new StringBuffer();
    while (iter.hasNext()) {
        String key = (String) iter.next();
        Object value = outputData.get(key);
        returnValue.append(value);
    }

    return returnValue.toString();    
}

public Object testMethod_5(params) {
    def inputData = [:];
    inputData.putAll(params);

    Set keys = inputData.keySet();
    Iterator iter = keys.iterator();
    StringBuffer keyValue = new StringBuffer();
    int totalValue = 0;
    while (iter.hasNext()) {
        String key = (String) iter.next();
        keyValue.append(key);
        Object value = inputData.get(key);
        totalValue += value;
    }

    def outputData = [keyValue.toString(), totalValue];
  
    return outputData;
}